public class Range_1_5_25 {
    public static void main(String[] args) {
        for (int x1 = 1; x1 < 8; x1++) {
            for (int x2 = 0; x2 < 8; x2++) {
                for (int x3 = 1; x3 < 8; x3++) {
                    if (x1 * 49 + x2 * 7 + x3 == x1 + x2 * 9 + x3 * 81) {
                        System.out.println(x1 * 49 + x2 * 7 + x3);
                        System.out.println(x1 + "" + x2 + "" + x3);
                        System.out.println(x3 + "" + x2 + "" + x1);
                    }
                }
            }
        }
    }
}